/* -*- Mode:Prolog; coding:ISO-8859-1; -*- */

:- use_module(library(lists)).

log(X) :- 
        is_list(X), !, 
        write_list(X), 
        write('\n'), flush_output.

log(X) :- 
        write(X), 
        write('\n').


log(h1, X) :- 
        is_list(X), !,
        write('\n###################################################################\n'), 
        write_list(X), 
        write('\n###################################################################\n').


log(h1, X) :- 
        write('\n###################################################################\n'), 
        write(X), 
        write('\n###################################################################\n').

log(h2, X) :- 
        is_list(X), !,
        write('\n________________________\n'), 
        write_list(X), 
        write('\n________________________\n').


log(h2, X) :- 
        write('\n________________________\n'), 
        write(X), 
        write('\n________________________\n').


write_list([]).
write_list([H | T]) :-
        write(H), 
        write(', '),       
        write_list(T).

wls(X) :- write_list_s(X).
write_list_s([]).
write_list_s([H | T]) :-
        write(H), 
        write(' '),       
        write_list_s(T).

write_list_r([]).
write_list_r([H | T]) :-
        write(H), 
        write('\n'),       
        write_list_r(T).

print_ilp_instance(E, B, M, IC, O) :-
        write('Background Knowledge (first 10 lines)----------------\n\n'),
        portray_list(B, 10),        
        write('Mode Declarations-------------------\n\n'),
        portray_list(M),        
        write('Integrity Constraints---------------\n\n'),
        portray_list(IC),
        write('\n\nExamples (max. 10)----------------------------\n\n'),
        portray_list(E, 10),                
        write('Options-----------------------------\n\n'),
        portray_list(O), nl, nl, nl.    
        
        
       
        
        
portray_list([]).       
portray_list([H | B]) :-
        portray_clause(H), 
        portray_list(B).


portray_list([], _).
portray_list(_, 0).
portray_list([H | B], N) :-
        portray_clause(H),
        N1 is N-1,
        portray_list(B, N1).